<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<link type="text/css" rel="stylesheet" href="../zxy/css/emp_info/emp_basic.css">
	<div style="padding:10px;width:50%;margin:30px;background:#E0ECFF;border:1px solid #95B8E7">
		<form id="zxy_eh_form" action="../emp/addEmpInfo" class="easyui-form">
			<table class="zxy_eb_table">
				<tbody>
					<tr>
						<td><span class="zxy_eb_table_title">员工姓名</span></td>
						<td><input class="zxy_ebe_table_item easyui-textbox" 
								name="empName" data-options="required:true"/></td>
					</tr>
					<tr>
						<td><span class="zxy_eb_table_title">部门</span></td>
						<td><input class="zxy_ebe_table_item easyui-combobox" name="depId" 
							data-options="required:true,url:'../dep/findAllDep',
								valueField:'depId',textField:'depName'"/>
						</td>
					</tr>
					<tr>
						<td><span class="zxy_eb_table_title">员工职务</span></td>
						<td><input class="zxy_ebe_table_item easyui-combobox" name="postId" 
							data-options="required:true,url:'../setting/findAllPostSetting',
								valueField:'postId',textField:'postName'"/>
						</td>
					</tr>
					<tr>
						<td><span class="zxy_eb_table_title">员工职级</span></td>
						<td><input class="zxy_ebe_table_item easyui-combobox" name="rankId" 
							data-options="required:true,url:'../setting/findAllRankSetting',
								valueField:'rankId',textField:'rankName'"/>
						</td>
					</tr>
					<tr>
						<td><span class="zxy_eb_table_title">用工状态</span></td>
						<td><input class="zxy_ebe_table_item easyui-combobox" name="workStatus" 
							data-options="required:true,valueField:'label',textField:'value',
								data: [{
									label: '1',
									value: '在职'
								},{
									label: '2',
									value: '试用'
								},{
									label: '3',
									value: '实习'
								}]"/>
						</td>
					</tr>
					<tr>
						<td><span class="zxy_eb_table_title">电话</span></td>
						<td><input class="zxy_ebe_table_item easyui-validatebox easyui-textbox" 
								name="tel" data-options="required:true,validType:'mobile'"/></td>
					</tr>
					<tr>
						<td><span class="zxy_eb_table_title">登录密码</span></td>
						<td><input class="zxy_ebe_table_item easyui-textbox" 
								name="password" data-options="required:true"/></td>
					</tr>
					<tr>
						<td><span class="zxy_eb_table_title">起薪日期</span></td>
						<td><input class="zxy_ebe_table_item easyui-datebox" 
								name="salaryBeginDate" data-options="required:true"/></td>
					</tr>
					<tr>
						<td><span class="zxy_eb_table_title">本薪账套</span></td>
						<td><input class="zxy_ebe_table_item easyui-combobox" name="baseSalarySobId" 
							data-options="required:true,url:'../baseSalary/queryAllSob',
							valueField:'baseSalarySobId',textField:'baseSalarySobName'"/></td>
					</tr>
					<tr>
						<td><span class="zxy_eb_table_title">本薪</span></td>
						<td><input class="zxy_ebe_table_item easyui-numberbox" 
								name="baseSalary" data-options="required:true"/></td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
	<div style="padding:10px;border-top:2px solid rgb(105, 150, 225);margin:30px">
		<a id="zxy_eh_submit" class="easyui-linkbutton" href="javascript:void(0)">提交</a>
	</div>
	
	<script>
		//验证规则
		$.extend($.fn.validatebox.defaults.rules, {
			//移动手机号码验证
			mobile: {//value值为文本框中的值
		        validator: function (value) {
		            var reg = /^1[3|4|5|8|9]\d{9}$/;
		            return reg.test(value);
		        },
		        message: '输入手机号码格式不准确.'
		    },
		});
		$("#zxy_eh_submit").linkbutton({
			onClick:function(){
				$("#zxy_eh_form").form('submit',{
					onSubmit: function(){
						var isValid = $(this).form('validate');
						if (!isValid){
							$.messager.progress('close');	// hide progress bar while the form is invalid
						}
						return isValid;	// return false will stop the form submission
					},
					success: function(data){
						if(data.success){
							$.messager.alert('操作成功',data.message);
						}else{
							$.messager.alert('操作失败',data.message);
						}
					}
				})
			}
		})
	</script>
</body>
</html>